//app.js
var configConst = require('./utils/config.js');
App({
  onLaunch: function () {
   
    //获取设备顶部窗口的高度（不同设备窗口高度不一样，根据这个来设置自定义导航栏的高度）
    wx.getSystemInfo({
      success: (res) => {
        this.globalData.height = res.statusBarHeight
        this.globalData.realWindowWidth = res.screenWidth
        this.globalData.realWindowHeight = res.screenHeight
        var height
        var sysinfo = wx.getSystemInfoSync()
        var isiOS = sysinfo.system.indexOf('iOS') > -1
        if(isiOS){
          height = 44
        }else {
          height = 48
        }
        this.globalData.barheight = height
        // 获取手机型号
        const model = res.model;
        const modelInclude = ["iPhone 12", "iPhone 11", "iPhone X", 'iPhone XR', "iPhone XS", "iPhone XS MAX"];
        var flag = false;//是否X以上机型
        for (let i = 0; i < modelInclude.length; i++) {
          //模糊判断是否是modelInclude 中的机型,因为真机上测试显示的model机型信息比较长无法一一精确匹配
          if (model.indexOf(modelInclude[i]) != -1) {
            flag = true
          }
        }
        if (flag) {
          //如果是这几个机型，设置距离底部的bottom值
          this.globalData.bottom = 25;
        }
      }
    })
  },
  onShow:function () {
    var userInfo = wx.getStorageSync('userInfo')
    this.globalData.roleType = userInfo?userInfo.roleType:'';
  },
  globalData: {
    height: 0,
    barheight: 0 ,
    realWindowWidth: 0,
    realWindowHeight: 0,
    classifyId:'', // 分类id
    roleType:'',   // 角色 1 食堂人员 2 档口人员
    bottom:0,
  }
})